package com.ruoyi.schoolSys.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.schoolSys.mapper.TeachMapper;
import com.ruoyi.schoolSys.model.vo.CourseVo;
import com.ruoyi.schoolSys.model.vo.StudentVo;
import com.ruoyi.schoolSys.service.IClazzService;
import com.ruoyi.schoolSys.service.ICourseService;
import com.ruoyi.schoolSys.service.IStudentService;
import com.ruoyi.schoolSys.service.TeachService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2024</p>
 * <p>公司: 中科天巡</p>
 *
 * @version: 1.0
 * @author: WangChaoTao
 * @date 2024/2/14
 */
@RestController
@RequestMapping("/schoolSys/teach")
public class TeachController {
    @Autowired
    private ICourseService courseService;
    @Autowired
    private TeachService teachService;
    @Autowired
    private IClazzService clazzService;
    @Autowired
    private IStudentService studentService;
    @Autowired
    private TeachMapper teachMapper;
    /**
     * 获取所有老师
     * @return
     */
    @GetMapping("/getAllTeacher")
    public AjaxResult getAllTeacher() {
        return AjaxResult.success(teachService.getAllTeacher());
    }

    /**
     * 获取所有课程
     * @return
     */
    @GetMapping("/getAllCourse")
    public AjaxResult getAllCourse() {
        return AjaxResult.success(courseService.selectCourseList(null));
    }

    /**
     * 获取班级
     * @return
     */
    @GetMapping("/getAllClazz")
    public AjaxResult getAllClazz() {
        return AjaxResult.success(clazzService.selectClazzList(null));
    }

    /**
     * 获取所有家长用户
     * @return
     */
    @GetMapping("/getAllpatriarch")
    public AjaxResult getAllPatriarch() {
        return AjaxResult.success(teachService.getAllPatriarch());
    }


    @GetMapping("/getAllStudent")
    public AjaxResult getAllStudent() {
        return AjaxResult.success(studentService.selectStudentList(null));
    }

    @PostMapping("/getChildrenList")
    public AjaxResult getChildrenList(@RequestParam("patriarchId") Long patriarchId){
        List<StudentVo> childrenList = teachMapper.getChildrenList(patriarchId);
        return AjaxResult.success(childrenList);

    }


}